#ifndef SKPOINT_H
#define SKPOINT_H

#include <QGraphicsItem>
#include <QList>
#include <QObject>
#include "skidable.h"

class SkLine;

QT_BEGIN_NAMESPACE
class QGraphicsSceneMouseEvent;
QT_END_NAMESPACE

class SkPoint : public QGraphicsItem ,public SkIdAble
{

public:
    SkPoint(const int& id,const QPointF& point,const qreal& radius, QGraphicsItem * parent=0);

    enum { Type = UserType + 1 };
    int type() const { return Type; }

    void addLine(SkLine *line);
    QList<SkLine *> lines() const;
    bool advance();

    QRectF boundingRect() const;
    QPainterPath shape() const;
    void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget);

    qreal radius() const;
protected:
    QVariant itemChange(GraphicsItemChange change, const QVariant &value);

    void mousePressEvent(QGraphicsSceneMouseEvent *event);
    void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);

private:
    QList<SkLine *> linesList;
    QPointF newPos;
    qreal skRadius;
};

#endif // SKPOINT_H
